<?php
/* [DoYouHaoBaby!] (C)Dianniu From 2010.
   this($)*/

!defined('DYHB_PATH') && exit;

class TemplateGtkGladeWidgetCompiler_GtkTreeView extends TemplateGtkGladeWidgetCompilerBase{

	protected function compileCreateWidget_(TemplateGtkGladeWidget $oObject){
		$sWidgetClass=$oObject->getWidgetClass();
		$sVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oObject);
		$sCompiled="\t\t{$sVariableName}=new {$sWidgetClass}();";
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('headers_visible'))===false){// 列头可见
			$sCompiled.="\t\t{$sVariableName}->set_headers_visible(false);";
		}
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('headers_clickable'))){// 列头可点击
			$sCompiled.="\t\t{$sVariableName}->set_headers_clickable(true);";
		}
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('reorderable'))){// 重新排列
			$sCompiled.="\t\t{$sVariableName}->set_reorderable(true);";
		}
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('rules_hint'))){// 规则提示
			$sCompiled.="\t\t{$sVariableName}->set_rules_hint(true);";
		}
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('enable_search'))===false){// 启用搜索
			$sCompiled.="\t\t{$sVariableName}->set_enable_search(false);";
		}
		if(($sValue=$oObject->getProperty('search_column'))!==null){// 搜索列
			$sCompiled.="\t\t{$sVariableName}->set_search_column({$sValue});";
		}
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('fixed_height_mode'))){// 高度固定
			$sCompiled.="\t\t{$sVariableName}->set_fixed_height_mode(true);";
		}
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('hover_selection'))){// 旋停选择
			$sCompiled.="\t\t{$sVariableName}->set_hover_selection(true);";
		}
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('hover_expand'))){// 旋停固定
			$sCompiled.="\t\t{$sVariableName}->set_hover_expand(true);";
		}

		/* show expanders
		 if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('show_expanders'))===false)
		 $sCompiled.= "\t\t{$sVariableName}->set_show_expanders(false);";
		 level_indentation
		 if(($sValue=$oObject->getProperty('level_indentation'))!==null)
		 $sCompiled.= "\t\t{$sVariableName}->set_level_indentation({$sValue});";
		 rubber_banding
		 if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('rubber_banding')))
		 $sCompiled.= "\t\t{$sVariableName}->set_rubber_banding(true);"; */

		if($sValue=TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('enable_tree_lines'))){// enable_tree_lines
			$sValue=str_replace('GTK_','Gtk::',$sValue);
			$sCompiled.="\t\t{$sVariableName}->set_grid_lines({$sValue});";
		}
		return $sCompiled;
	}

	protected function compileChildWidgetPacking_(TemplateGtkGladeWidget $oParentWidget,TemplateGtkGladeWidget $oChildWidget,TemplateGtkGladeWidgetPacking $oPacking){}

	static public function regToProcessorManager(ITemplateObjProcessorManager $oManager){
		$oManager->regProcessor(str_replace('TemplateGtkGladeWidgetCompiler_','',__CLASS__),__CLASS__);
	}

}
